<?php
/**
 * interfaces file.
 * 
 * Core interfaces to CPage and child classes.
 * 
 * @author Lucas Vasconcelos <contato@lucasvasconcelos.com>
 * @copyright Copyright(c) 2010 Lucas Vasconcelos
 * @license BSD License http://www.vasconcelossa.com.br/yap/license
 * @link http://www.vasconcelossa.com.br/yap/
 * @version $Id: interfaces.php 21 2010-02-09 19:48:24Z contato@lucasvasconcelos.com $
 * @package yap.web.ui
 */

/**
 * 
 * @author Lucas Vasconcelos <contato@lucasvasconcelos.com>
 * @version 1.1 $Revision: 21 $
 * @package yap.web.ui
 */
interface IPageGrid
{
	/**
	 * @var string id of main TDataGrid object.
	 */
	const GRID_ID='grid';
	
	public function onSetupGrid($param);
	public function onSetupCriteria($param);
	public function onLoadGrid($param);
	public function getGridManager();
	
	/**
	 * @return string condição sql para consulta da fonte de dados.
	 */
	public function getCriteriaCondition();
	
	/**
	 * @param TActiveRecordCriteria objeto com filtros para a consulta.
	 * @return array geralmente um vetor de objeto TActiveRecord.
	 */
	public function getData(TActiveRecordCriteria $criteria);
}


/**
 * Define interface para artefatos de cadastro.
 * 
 * @author Lucas Vasconcelos <contato@lucasvasconcelos.com>
 * @version 1.0 $Revision: 21 $
 * @package yap.web.ui
 */
interface IPageCrud
{
	/**
	 * @var string prefixo que identifica campos do formulário.
	 */
	const FIELD_PREFIX = 'f_';
	
	public function onCreate($param);
	public function onRead($param);
	public function onUpdate($param);
	public function onDelete($param);
	public function onView($param);
	public function onSave($param);
	public function onBindFields($param);

	public function setAction($value);
	public function getAction();
	public function getCrudManager();
	public function getRecord();

	/**
	 * @return TActiveRecord finder do AR principal da página.
	 */
	public function getFinder();

	/**
	 * @return string identificados para grupo de campos principal.
	 */
	public function getAliasId();

	public function initForm();
	public function beforeSave(TActiveRecord $record);
	public function afterSave(TActiveRecord $record);
	public function beforeDelete(TActiveRecord $record);
	public function afterDelete();
	public function allowedActions();
}